function render(list) {
  let oBody = document.querySelector('tbody')
  for (let i in list) {
    let track = list[i]
    let html = `          <tr>
            <td>${track.tid}</td>
            <td><a target="_blank" href="/track?tid=${track.tid}">${track.title}</a></td>
            <td>${track.count}</td>
          </tr>`
    oBody.innerHTML += html
  }
}

window.addEventListener('load', function () {
  let xhr = new XMLHttpRequest()
  xhr.open('get', '/studio/track/list.json')
  xhr.addEventListener('load', function () {
    console.log(xhr.responseText)
    let data = JSON.parse(this.responseText)
    renderCurrentUser(data.currentUser)
    if (data.trackList) {
      render(data.trackList)
    }
  })
  xhr.send()
})